<?php
function todaySnsq($todaySizhu){//今天生年岁前
    $dizhi=array('0','子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥');//地支
    $nd=array_search(mb_substr($todaySizhu['0'],1,1,'utf-8'),$dizhi);
    $yd=array_search(mb_substr($todaySizhu['1'],1,1,'utf-8'),$dizhi);
    $rd=array_search(mb_substr($todaySizhu['2'],1,1,'utf-8'),$dizhi);

    //        获取生年岁前12星
    $datasnsq=array('丧门','贯索','官符','小耗','大耗','龙德','白虎','天德','吊客','病符','岁建','晦气');
    if($nd>=2){
        $datasnsqwz=13-$nd;
        $arrsnsq=array_slice($datasnsq,$datasnsqwz);
        $snsq=array_merge($arrsnsq,$datasnsq);
    }else{$snsq=$datasnsq;}
    $Arr['lnSnsq']=$snsq;

    if($yd>=2){
        $datasnsqwz=13-$yd;
        $arrsnsq=array_slice($datasnsq,$datasnsqwz);
        $snsq=array_merge($arrsnsq,$datasnsq);
    }else{$snsq=$datasnsq;}
    $Arr['lySnsq']=$snsq;

    if($rd>=2){
        $datasnsqwz=13-$rd;
        $arrsnsq=array_slice($datasnsq,$datasnsqwz);
        $snsq=array_merge($arrsnsq,$datasnsq);
    }else{$snsq=$datasnsq;}
    $Arr['lrSnsq']=$snsq;

    return $Arr;
}
function todaySngx($todaySizhu){//今天生年干系诸星
    $dizhix=array('寅','卯','辰','巳','午','未','申','酉','戌','亥','子','丑');
    $tiangan=array('0','甲','乙','丙','丁','戊','己','庚','辛','壬','癸');//天干

    $ng=array_search(mb_substr($todaySizhu['0'],0,1,'utf-8'),$tiangan);
    $yg=array_search(mb_substr($todaySizhu['1'],0,1,'utf-8'),$tiangan);
    $rg=array_search(mb_substr($todaySizhu['2'],0,1,'utf-8'),$tiangan);
    $tgData=array('lnSngx'=>$ng,'lySngx'=>$yg,'lrSngx'=>$rg);

//        获取生年干系诸星
    foreach($tgData as $key=>$value){
        $datangzx=M()->query("select * from tb_shengniangx where id=".$value);
        $dataqyang=array_search($datangzx[0]['qyang'],$dizhix);
        $sngx=array();
        $sngx[$dataqyang]='擎羊';
        $datatluo=array_search($datangzx[0]['tluo'],$dizhix);
        $sngx[$datatluo]=$sngx[$datatluo].'陀罗';
        $datatyue=array_search($datangzx[0]['tyue'],$dizhix);
        $sngx[$datatyue]=$sngx[$datatyue].'天钺';
        $datatkui=array_search($datangzx[0]['tkui'],$dizhix);
        $sngx[$datatkui]=$sngx[$datatkui].'天魁';
        $datalcun=array_search($datangzx[0]['lcun'],$dizhix);
        $sngx[$datalcun]=$sngx[$datalcun].'禄存';
        $Arr[$key]=$sngx;
    }
    return $Arr;
}
function emailText($orderid,$jgOrderUrl){
    $strData="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
        <tbody><tr>
            <td>
                <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse;\" width=\"750\">
                    <tbody><tr>
                        <td>
                            <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"font-size:16px; border-collapse: collapse;background: #fbe1a3;\" width=\"750\">
                                <tbody><tr style=\"height: 20px;\"></tr>
                                <tr>
                                    <td style=\"padding-left: 10px;\">
                                        <a href=\"\">
                                            <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/effab44b6e4472-144x59.png\" style=\"display: block; vertical-align: middle; border: none;\">
                                        </a>
                                    </td>
                                    <td>
                                        <a href=\"http://sm.pingushi.net/index#/?channel=dzyj001\" style=\"color: #743c00; text-decoration: none;\">
                                            大师亲测 |
                                        </a>
                                    </td>
                                    <td>
                                        <a href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Bzjp-index?channel=dzyj001\" style=\"color: #743c00; text-decoration: none;\">
                                            八字精批 |
                                        </a>
                                    </td>
                                    <td>
                                        <a href=\"http://wx1.zmweb.top/zhiming/index.php/home-lnyc2020-index?channel=dzyj001\" style=\"color: #743c00; text-decoration: none;\">
                                            2020年运 |
                                        </a>
                                    </td>
                                    <td style=\"padding-right: 10px;\">
                                        <a href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Bzcy-index?channel=dzyj001\" style=\"color: #743c00; text-decoration: none;\">
                                            八字财运
                                        </a>
                                    </td>
                                </tr>
                                <tr style=\"height: 20px;\"></tr>
                                </tbody></table>
                        </td>

                    </tr>
                    <tr style=\"height: 42px;\"></tr>
                    <tr align=\"center\">
                        <td>
                            <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"690\">
                                <tbody><tr>
                                    <td>
                                        <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/6f6f34e04ce0cd-690x94.png\" style=\"vertical-align: middle; border: none;\">
                                    </td>
                                </tr>
                                <tr style=\"background-image: url('http://hy.yixueqm.com/zhiming/Public/images/email/0ef873a04290b1-690x244.jpg'); background-size: 100%;background-position: top center;\">
                                <td style=\"padding: 0 25px; font-size: 30px; color: #333;\">
                                    <p style=\"margin-bottom: 12px;\">感谢您对知命文化的肯定，这是您的订单信息：</p>
                                    <p style=\"margin-bottom: 12px;\">服务内容：知命在线付费</p>
                                    <p style=\"margin-bottom: 12px;\">订单号：{$orderid}</p>
                                    <a href=\"{$jgOrderUrl}\" style=\"display: block; color: #ffffff; background: #b91c1c; text-align: center; text-decoration: none;
                                        font-size: 30px; height: 40px; line-height: 40px; border-radius: 10px;width: 474px;height: 73px;background-image: linear-gradient(0deg, #ff4242 0%, #ff8787 100%);border-radius: 10px;line-height:73px;margin:0 auto;\">

                                        查看测算结果
                                    </a>
                                </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/86ba5c33c743a0-690x40.jpg\" style=\"display: block; vertical-align: middle; border: none;\">
                                    </td>
                                </tr>
                                </tbody></table>
                        </td>
                    </tr>
                    <tr style=\"height: 42px;\">
                        <td></td>
                    </tr>

                    <tr align=\"center\">
                        <td>
                            <a href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Bzjp-index?channel=dzyj001\">
                                <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/103078160a5c71-686x160.png\">
                            </a>
                        </td>
                    </tr>
                    <tr style=\"height: 34px;\">
                        <td></td>
                    </tr>



                    <tr style=\"height: 34px;\">
                        <td></td>
                    </tr>



                    <tr align=\"center\">
                        <td>
                            <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"690\">
                                <tbody><tr>
                                    <td>
                                        <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/75c5242835349b-690x94.png\" style=\"vertical-align: middle; border: none;\">
                                    </td>
                                </tr>
                                <tr style=\"background-image: url('http://hy.yixueqm.com/zhiming/Public/images/email/0ef873a04290b1-690x244.jpg'); background-size: 100% 244px;background-position: top center; background-repeat: y;\">
                                <td>
                                    <table align=\"center\" style=\"text-align: center; font-size: 14px; color: #333;\" width=\"100%\">
                                        <tbody><tr>
                                            <td colspan=\"4\">
                                                <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/6869afe6fb578b-393x59.png\" style=\"vertical-align: middle; border: none;\">
                                            </td>
                                        </tr>
                                        <tr style=\"height: 32px;\">
                                            <td colspan=\"4\"></td>
                                        </tr>
                                        <tr>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Bzjp-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/1.png\" style=\"vertical-align: middle; border: none;\">
                                                    <p  style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">八字精批</p>
                                                </a>
                                            </td>
                                            <td width=\"25%\">
                                                <a  style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/home-lnyc2020-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/2.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">2020年运</p>
                                                </a>
                                            </td>
                                            <td width=\"25%\">
                                                <a  style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/home-myys-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/3.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">每月运势</p>
                                                </a>
                                            </td>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/home-xzcs-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/4.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">星座运势</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                        </tr>
                                        <tr style=\"height: 32px;\">
                                            <td colspan=\"4\"></td>
                                        </tr>
                                        <tr>
                                            <td colspan=\"4\">
                                                <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/b12cdc35a51a2a-393x59.png\" style=\"vertical-align: middle; border: none;\">
                                            </td>
                                        </tr>
                                        <tr style=\"height: 32px;\">
                                            <td colspan=\"4\"></td>
                                        </tr>
                                        <tr>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Bzcy-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/5.png\" style=\"vertical-align: middle; border: none;\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">八字财运</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Bzsy-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/6.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">八字事业</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/ysyc/index.php/index/ysyc/index?typeName=wealthCode&typeid=51?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/7.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">一生财富</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/home-zwds-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/8.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">一生运势</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan=\"4\">
                                                <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/92daa4a5451e9a-393x59.png\" style=\"margin-top:30px;vertical-align: middle; border: none;\">
                                            </td>
                                        </tr>
                                        <tr style=\"height: 32px;\">
                                            <td colspan=\"4\"></td>
                                        </tr>
                                        <tr>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Hyzs-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/9.png\" style=\"vertical-align: middle; border: none;\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">姻缘走势</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/Home-Bzhh-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/10.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">八字合婚</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/ysyc/index.php/index/ysyc/index?typeName=loveAstrolabe&typeid=62?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/11.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">八字姻缘</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                            <td width=\"25%\">
                                                <a style=\"text-decoration: none;\" href=\"http://wx1.zmweb.top/zhiming/index.php/home-lath-index?channel=dzyj001\">
                                                    <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/12.png\">
                                                    <p style=\"color: #8a5c02;text-decoration: none;font-size: 30px;\">桃花运</p>
                                                </a style=\"text-decoration: none;\">
                                            </td>
                                        </tr>
                                        </tbody></table>
                                </td>
                                </tr>
                                <tr>
                                    <td>
                                        <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/86ba5c33c743a0-690x40.jpg\" style=\"display: block; vertical-align: middle; border: none;\">
                                    </td>
                                </tr>
                                </tbody></table>
                        </td>
                    </tr>
                    <tr style=\"height: 34px;\">
                        <td></td>
                    </tr>
                    <tr align=\"center\">
                        <td>
                            <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"690\">
                                <tbody><tr>
                                    <td>
                                        <a href=\"http://sm.pingushi.net/index#/?channel=dzyj001\">
                                            <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/dd5f32ffc01cb1-331x220.png\" style=\"display: block; vertical-align: middle; border: none;\">
                                        </a>
                                    </td>
                                    <td>
                                        <a href=\"http://wx1.zmweb.top/zhiming/index.php/home-lnyc2020-index?channel=dzyj001\">
                                            <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/28c3f338c6b1c5-331x220.png\" style=\"display: block; vertical-align: middle; border: none;\">
                                        </a>
                                    </td>
                                </tr>
                                <tr style=\"height: 30px;\">
                                    <td colspan=\"2\">
                                    </td>
                                </tr>
                                <tr style=\"text-align: center\">
                                    <!-- <td colspan=\"2\">
                                        <a href=\"http://sctrack.sc.gg/track/click/eyJtYWlsbGlzdF9pZCI6IDAsICJ0YXNrX2lkIjogIiIsICJlbWFpbF9pZCI6ICIxNTc3Njk0MTAwNTE1XzM0MjI3XzIwNjgyXzUyMjAuc2MtMTBfOV81NV8xMi1pbmJvdW5kMCQzMzkwMzIzMjNAcXEuY29tIiwgInNpZ24iOiAiN2M4YTk3ZGM4NTM5MTlhNjNlZTYwYjFmOTk4MjdhYzAiLCAidXNlcl9oZWFkZXJzIjoge30sICJsYWJlbCI6ICIyOTE2MiIsICJ0cmFja19kb21haW4iOiAic2N0cmFjay5zYy5nZyIsICJsaW5rIjogImh0dHBzJTNBLy9tLnlpcWl3ZW4uY24vZGlzdC96cGN5Lmh0bWwlMjMvJTNGY2hhbm5lbCUzRHlvdWppYW5famllZ3VvMSIsICJ1c2VyX2lkIjogMzQyMjcsICJjYXRlZ29yeV9pZCI6IDgwOTIyfQ==.html\" style=\"text-align: center; color: #b91c1c; font-size: 14px; margin: 30px 0;\">还有任何问题来找知名老师一对一解答 &gt;&gt;&gt;</a>
                                    </td> -->
                                </tr>
                                <tr style=\"height: 30px;\">
                                    <td colspan=\"2\">
                                    </td>
                                </tr>
                                </tbody></table>
                        </td>
                    </tr>
                    <tr style=\"height: 34px;\">
                        <td></td>
                    </tr>
                    <tr align=\"center\">
                        <td>
                            <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"690\" style=\"background-color: #fff9dd;\">
                                <tbody>
                                <tr style=\"height: 25px;\"></tr>
                                <tr>
                                    <td style=\"text-align: right;\">
                                        <img src=\"http://hy.yixueqm.com/zhiming/Public/images/email/erweima.jpg\" style=\"display: block; vertical-align: middle; border: none;float: right; margin-right: 25px;\">
                                    </td>
                                    <td style=\"font-size: 15px; color: #333; text-align: left\">
                                        <p>知命合作大师团队倾力打造</p>
                                        <p>知命微信客服：qumingxiaoxue</p>
                                        <p>知命QQ客服：2307821835</p>
                                    </td>
                                </tr>
                                <tr style=\"height: 25px;\"></tr>
                                </tbody></table>
                        </td>
                    </tr>
                    </tbody></table>
            </td>
        </tr>
        </tbody></table>
    </div>";
    return $strData;
}